<template>
    <div>
        <el-dialog title='人脸检测' :visible.sync="isShow" @close="onClose" width="50%" :key="dialogKey">
            <div class="common-view1">
                <img class="header-view" :src="validateImage" v-if="validateImage" >
<!--              <el-image class="header-view" :src="validateImage" fit="cover" v-if="validateImage" ></el-image>-->
              <div v-else>未录入</div>
            </div>

        </el-dialog>
    </div>
</template>
<script>
import {getDeptCoursePriceList} from '@/api/teacher.js'

    export default {
        props: ['isShowDialog', 'selectStudentId','deptTeacherId','selectMonth','selectValidateImage'],
        data() {
            return {
                studentId: this.selectStudentId,
                deptId: this.deptTeacherId,
                validateImage: this.selectValidateImage,
                //   是否显示当前dialog
                isShow: this.isShowDialog,
                month:this.selectMonth,
                dialogKey: Math.random(),
                validateImages: [],
                randomKey: parseInt(Math.random() * 10000000)
            }
        },
        watch: {
            selectStudentId: {
                handler(newValue, oldValue) {
                    this.studentId = newValue;
                    this.dialogKey = Math.random()
                },
                deep: true
            }
        },
        created() {
          // this.faceRecognition();
          console.log("验证图片是：",this.validateImage);
        },
        computed: {},
        mounted() {
        },
        methods: {
            //关闭弹窗清空表单
            onClose() {
                this.$emit('closeFaceRecordStatistics')
            },
            //人脸识别
            faceRecognition(){
              let dataForm = {
                deptId:this.deptId,
                searchDate:this.month,
              }
              console.log("dataForm=",dataForm);
              this.validateImages = []
              getDeptCoursePriceList(dataForm).then(resp=>{
                console.log('人脸识别数据返回',resp)
                if(resp.code==200){
                  if(resp.data.deptCourseList && resp.data.deptCourseList.length>0){
                    this.validateImages = resp.data.deptCourseList.map(item=>process.env.VUE_APP_BASE_API + item.validate_image)
                  }
                  console.log("图片信息是",this.validateImages);
                }
              })
            },

        },
    }
</script>
<style lang="scss" scoped>
    .common-view1 {
        width: 100%;
        height: calc(60vh);
        padding: 5px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .header-view {
          width: 400px;
          height: 400px;
          margin-bottom: 10px
        }
    }

    /deep/ .el-dialog__wrapper {
        position: fixed;
        top: 10px;
    }

    /deep/ .el-dialog {
        -webkit-transform: none;
        transform: none;
        text-align: center;
        left: 0;
        position: relative;
        margin: 0 auto;
        border-radius: 15px;
    }

    /deep/ .el-dialog__title {
        line-height: 0.125rem;
        font-size: 0.09375rem;
        color: #303133;
        flex: auto;
        text-align: center;
        font-weight: bold;
    }



</style>

